﻿@using KhuyenMaiVang.HtmlHelpers;
@using KhuyenMaiVang.DAL;
@{
    List<Voucher>  Model = new List<Voucher>();
}
<link href="@Url.Content("~/Content/ListVoucherAdvertise.css")" rel="stylesheet" type="text/css" />
@foreach (var v in Model)
{ 
    <div class="ad-voucher ">
        <a class="ad-title">@v.Title</a>
        @Html.ImageLink("VoucherDetail", "Home", v.Thumb, v.Title, new { id = v.ID })
        <div class="menu-price">
            <span class="ad-price">
                <span class="unit-price">VND</span>
                <span class="num-price">@v.SellPrice.Value.ToString("#.#,#")</span>
            </span>
            <span class="ad-save">
                <span class="">Tiết kiệm</span><br />
                @{
                        String save = "?";
                        if (v.CostPrice.HasValue && v.CostPrice != 0 && v.SellPrice.HasValue)
                        {
                            save = ((1 - v.SellPrice / v.CostPrice) * 100).Value.ToString("#,#.#");                            
                        }   
                }
                <span>@save</span>
            </span>
        </div>
    </div>   
}